perm filename DRUM.DOC[SYS,BGB] blob
sn#100503 filedate 1974-05-07 generic text, type T, neo UTF8
DRUM
SAIL ACCESSIBLE
DYNAMIC STORAGE ALLOCATION ROUTINES FOR USER FAST BANDS
Bruce g. Baumgart
The require source file statement for declaring the DRUM routines is
REQUIRE "DRUMER[SYS,BGB]" SOURCE_FILE;
The SAIL declarations for the drum routines are:
REQUIRE "DRUM[SYS,BGB]" LOAD_MODULE;
EXTERNAL INTEGER PROCEDURE DRUMA (INTEGER SIZE);
EXTERNAL PROCEDURE DRUMO (INTEGER ADR,FBPTR);
EXTERNAL PROCEDURE DRUMI (INTEGER ADR,FBPTR);
EXTERNAL PROCEDURE DRUMR (INTEGER FBPTR);
THE DRUM
The DRUM is a General Precision Inc., Librafile 4800, Mass
Memory Librascope, fixed head disc. There were three of them built,
ours and two that are at AEC's LRL. The DRUM used to have 144
(decimal) bands, of which half are still addressible after the big
crash in the summer of '69. The surviving 72 bands each hold 76K
words, for a total capacity of 5.472 Megawords. At Present the drum
is mostly used for swapping at the rate of one band per job.
However, any user may have up to 32 (decimal) of the bands. by
calling the Special Librascope UUO's, see section II.D.9 of Moorer's
Sailon 55.2.
The drum rotates at 900 RPM, which is 86 milli seconds per
revolution, which is also the maximum amount of time you might have
to wait for the start of a drum transfer. Once started, the drum can
read or write at core speeds, 1.6 micro seconds per word.
ALLOCATE and RELEASE
Allocate FBPTR ← DRUMA(SIZE);
Release DRUMR(FBPTR);
The routines named DRUMA and DRUMR allocate and release
blocks of drum space by the so called "First Fit" method suggested in
Knuth's section on Dynamic Storage Allocation, p435, v1. The storage
lists are kept in core and allow up to one thousand blocks.
The allocate routine takes an integer argument which
specifies the number of words desired in a block, and returns an
integer called the Fast Band Pointer. The FBPTR contains a band
number in bits 0-5, a sector address in bits 6-17 and the size of the
block in words in bits 18-35.
The release routine returns the FBPTR's drum space to the
free storage list.
INPUT and OUTPUT
Input DRUMI(ADR,FBPTR);
Output DRUMO(ADR,FBPTR);
The routines named DRUMI and DRUMO transfer blocks of core
memory in from the drum or out to the drum. Only sanity requires the
use of a DRUMO before a DRUMI. The drum I/O routines take two
integer arguments which specify a core address, a drum address and a
block size in words. Core address of arrays may be gotten in sail by
either:
ADR ← POINT (36,ARRY[1],35);
or more swiftly:
QUICK_CODE MOVE 11,ARRY; MOVEM 11,ADR;END;
BEGIN "FBTEST"
DEFINE α="COMMENT";
REQUIRE "DRUMER[SYS,BGB]" SOURCE_FILE;
REQUIRE "RANDER[SYS,BGB]" SOURCE_FILE;
α SIMULATION PARAMETERS;
DEFINE BLKCNT="100",BLKSIZ="10000";
INTEGER ARRAY CONTENT,LIFE,SIZE,FBPTR[1:BLKCNT];
α Misc temporaries;
INTEGER I,J,X,SIZ,PTR,ADR;
PROCEDURE CREATE (INTEGER I);
BEGIN "CREATE"
SIZE[I]←SIZ← RANDOM*BLKSIZ+10;
LIFE[I] ← RANDOM*100;
CONTENT[I]←X← RANDOM*10000000;
FBPTR[I]←PTR← DRUMA(SIZ);
BEGIN
INTEGER ARRAY BLOCK[1:SIZ];
BLOCK[1]← X;
ARRBLT(BLOCK[2],BLOCK[1],SIZ-1);
ADR ← POINT(36,BLOCK[1],35);
DRUMO(ADR,PTR);
END;
OUTCHR("C");
END "CREATE";
PROCEDURE DESTROY (INTEGER I);
BEGIN "DESTROY"
SIZ ← SIZE[I];
X ← CONTENT[I];
PTR ← FBPTR[I];
BEGIN
INTEGER K;
INTEGER ARRAY BLOCK[1:SIZ];
ADR ← POINT(36,BLOCK[1],35);
DRUMI(ADR,PTR);
FOR K←1 STEP 1 UNTIL SIZ DO
IF BLOCK[K]≠X THEN OUTCHR("-");
DRUMR(PTR);
END;
OUTCHR("D");
END "DESTROY";
α INITIAL CREATION;
FOR I←1 STEP 1 UNTIL BLKCNT DO CREATE(I);
OUTSTR(13&10&"INITIALIZATION COMPLETED."&13&10);
α DYNAMIC STORAGE EXERCISER;
WHILE TRUE DO
BEGIN "FOREVER"
OUTCHR(".");
FOR I←1 STEP 1 UNTIL BLKCNT DO
IF (LIFE[I]←LIFE[I]-1)≤0 THEN
BEGIN DESTROY(I);CREATE(I);END;
END "FOREVER";
END "FBTEST"